package de.tabuma.customer.logik;

import java.util.*;
import java.util.logging.*;
import de.tabuma.customer.entity.*;

/**
 * @author $Author: alefen $
 * @version $Revision: 1.1.1.1.6.1 $
 * @since $Date: 2010/01/13 10:12:31 $
 */
public class CustomerUserRelationFacade {

    private static final Logger log = Logger.getLogger(CustomerUserRelationFacade.class.getName());

    public static int create(CustomerUserRelation cur, String user) {
        return (int) PMF.doCreate(cur, user);
    }

    public static CustomerUserRelation get(int id) {
        return (CustomerUserRelation) PMF.get(id, new CustomerUserRelation());
    }

    public static void update(CustomerUserRelation cur, String user) {
        PMF.doUpdate(cur, user);
    }

    public static void remove(CustomerUserRelation cur, String user) {
        PMF.doRemove(cur, user);
    }

    public static CustomerUserRelation getByCustomerId(int id) {
        String keys[] = new String[1];
        keys[0] = "costumerId";
        String values[] = new String[1];
        values[0] = ""+id;
        List<CustomerUserRelation> curList = PMF.get(keys, values, new CustomerUserRelation());
        if(curList.size()>0) {
            return curList.get(0);
        }
        return null;
    }

    public static List<CustomerUserRelation> getList1(int id) {
        String keys[] = new String[1];
        keys[0] = "costumerId";
        String values[] = new String[1];
        values[0] = ""+id;
        List<CustomerUserRelation> curList = PMF.get(keys, values, new CustomerUserRelation());
        return curList;
    }

    public static List<CustomerUserRelation> getList(String user) {
        String keys[] = new String[1];
        keys[0] = "user";
        String values[] = new String[1];
        values[0] = user;
        return PMF.get(keys, values, new CustomerUserRelation());
    }
    
}